﻿
using System;
using System.Collections.Generic;
using System.Text;

using YouHP.Utility;
using YouHP.BLL;
using YouHP.Model;

namespace YouHP.Pages.TreatmentHistory
{
    public class HistoryDel : PatientBasePage
    {

        protected override void ShowPage()
        {
            base.ShowPage();
            if (ErrorCount > 0) return;

            HandleCommon();

        }

        protected new  void HandleCommon()
        {
            this.AddLocation("治疗记录", "/TreatmentHistory/Index.aspx");
            this.AddLocation("删除治疗", "/TreatmentHistory/HistoryDel.aspx");
            this.SetTitle("删除治疗");

            int id = RequestTools.GetQueryInt("id", 0);
            if (id <= 0)
            {
                this.AddErrLine("无效的参数");
                return;
            }
            TreatmentHistoryInfo info = PatientTreatmentBLL.Instance.GetTreatmentRecorde(PrData.Id, id);


            bool succ = PatientTreatmentBLL.Instance.DelTreatmentRecorde(PrData.Id, id);
            if (succ)
            {
                this.AddMsgLine("删除成功");
            }
            else 
            {
                this.AddErrLine("删除失败");
            }
            this.SetUrl("/TreatmentHistory/List.aspx?trmid=" + info.TreatmentId);
            this.SetMetaRefresh();
        }

    }
}